package me.hellp.helloworld.design.builder;

import java.util.List;

/** 
 * 具体的生成器实现对象 
 * 
 */  
public class JspFiltBuilder implements Builder {  
	private String head;
	private String body;
	private String foot;
	
	@Override
	public void buildHeader(String header) {
		this.head = "JSP Head " + header;	
	}

	@Override
	public void buildBody(List<String> list) {
		StringBuilder builder = new StringBuilder();
		for(String s : list){
			builder.append("<%>" + s + "</%>");
		}
		
		this.body = builder.toString();		
		
	}

	@Override
	public void buildFooter(String footer) {
		this.foot = "HTML Footer " + footer;		
	}

	@Override
	public Product getProduct() {
		return new JspProduct(this.head + this.body + this.foot);
	}  
  
}  